import axios from '../utils/axios'
const gethousingList = (payload) => { // 房源管理获取表格数据
  const { type = 'sellTower', pageindex, pagesize, keyWord } = payload
  return axios.get(`/gethousing/${type}`, {
    params: {
      pageindex, pagesize, keyWord
    }
  })
}
const edithousingList = (payload) => {
  const { type = 'sellTower', housingForm, isSwitch, id } = payload
  return axios.post(`/housingEdit/${type}`, {
    housingForm,
    isSwitch,
    id
  })
}

const deleteHousingList = (payload) => {
  const { type = 'sellTower', id } = payload
  return axios.delete(`/housingDel/${type}`, {
    data: {
      id
    }
  })
}
const addHousingList = (payload) => {
  const { type = 'sellTower', housingForm = {} } = payload
  return axios.put(`/housingAdd/${type}`, {
    housingForm
  })
}

const getbrokerList = (payload) => { // 经纪人管理获取表格数据
  const { pageindex, pagesize, keyWord, status } = payload
  return axios.get('/getbroker', {
    params: {
      pageindex, pagesize, keyWord, status
    }
  })
}

const deleteBrokerList = (payload) => { // 删除
  const { id } = payload
  return axios.delete('/delBroker', {
    data: { id }
  })
}

const editBrokerList = (payload) => { // 编辑
  const { brokerForm, id } = payload
  return axios.post('/editBroker', {
    brokerForm,
    id
  })
}

const addBrokerList = (payload) => { // 添加
  const { brokerForm } = payload
  return axios.put('/addBroker', {
    brokerForm
  })
}

const getinformationList = (payload) => { // 资讯管理获取表格数据
  const { pageindex, pagesize, keyWord } = payload
  return axios.get('/information', {
    params: {
      pageindex, pagesize, keyWord
    }
  })
}

const deleteInfoList = (payload) => {
  const { id } = payload
  return axios.delete('/delInfo', {
    data: {
      id
    }
  })
}

const editInfoList = (payload) => {
  const { infoForm, isSwitch, id } = payload
  return axios.post('/editInfo', {
    infoForm,
    isSwitch,
    id
  })
}

const addInfoList = (payload) => {
  const { infoForm } = payload
  return axios.put('/addInfo', {
    infoForm
  })
}
const getorderList = (payload) => { // 订单管理获取表格数据
  const { pageindex, pagesize, keyWord } = payload
  return axios.get('/order', {
    params: {
      pageindex, pagesize, keyWord
    }
  })
}
const delorderList = (payload) => {
  const { id } = payload
  return axios.delete('/order', {
    data: { id }
  })
}

const getliveList = (payload) => { // 直播管理获取表格数据
  const { type, pageindex, pagesize, keyWord } = payload
  return axios.get('/live', {
    params: {
      pageindex, pagesize, keyWord, type
    }
  })
}

const getauditList = (payload) => { // 审核管理获取表格数据
  const { type = 'all', pageindex, pagesize, keyWord } = payload
  return axios.get(`/audit/${type}`, {
    params: {
      pageindex, pagesize, keyWord
    }
  })
}

const editauditList = (payload) => {
  const { auditForm } = payload
  return axios.post('/editAudt', {
    auditForm
  })
}
const deleteAuditList = (payload) => {
  const { id } = payload
  return axios.delete('/delAudit', {
    data: {
      id
    }
  })
}
export default {
  gethousingList,
  edithousingList,
  deleteHousingList,
  addHousingList,
  getbrokerList,
  deleteBrokerList,
  editBrokerList,
  addBrokerList,
  getinformationList,
  editInfoList,
  addInfoList,
  deleteInfoList,
  getorderList,
  delorderList,
  getliveList,
  getauditList,
  editauditList,
  deleteAuditList
}
